<template>
  <div class="container">
    <h3>注册</h3>
    <div class="form">
      <ul>
        <li>
          用户名:<input type="text" v-model="username">
        </li>
        <li>
          密码:<input type="password" v-model="password">
        </li>
        <li>
            邮箱:<input type="text" v-model="email">
          </li>
      </ul>
      <button @click="register">注册</button>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const username = ref('')
const password = ref('')
const email = ref('')
const router = useRouter()
const register = () => {
  window.localStorage.setItem('userInfo', JSON.stringify({
    username: username.value,
    email: email.value,
    password: password.value
  }))
  router.push({
    path: '/login',
    query: {
      username: username.value,
      email: email.value,
      password: password.value
    }
  })
}
</script>
<style>
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

li {
  list-style: none;
}
</style>
